function e(e, t, n) {
    return t in e ? Object.defineProperty(e, t, {
        value: n,
        enumerable: !0,
        configurable: !0,
        writable: !0
    }) : e[t] = n, e;
}

var t = require("../../../../../component/WxNotificationCenter/WxNotificationCenter.js"), n = getApp();

Page({
    data: {
        titleArray: [],
        setArray: [],
        permission: []
    },
    onLoad: function(e) {
        var t = JSON.parse(e.permission), a = e.title;
        wx.setNavigationBarTitle({
            title: a
        });
        var o, i, l = wx.getStorageSync(n.storage.meInfo), c = l.teamId, r = l.role, h = c.length > 0;
        o = 1 == parseInt(r) ? h ? [ "向所有人公开", "向我关注的人公开", "公司成员可见", "向白名单用户公开", "向黑名单用户隐藏", "向所有人隐藏" ] : [ "向所有人公开", "向我关注的人公开", "向白名单用户公开", "向黑名单用户隐藏", "向所有人隐藏" ] : h ? [ "向所有人公开", "向我关注的人公开", "团队成员可见", "向策划师公开", "向白名单用户公开", "向黑名单用户隐藏", "向所有人隐藏" ] : [ "向所有人公开", "向我关注的人公开", "向策划师公开", "向白名单用户公开", "向黑名单用户隐藏", "向所有人隐藏" ], 
        "个人主页档期显示" == a ? i = h ? [ "scheduleAll", "scheduleAttention", "scheduleTeam", "schedulePlanner", "scheduleWhite", "scheduleBlack", "scheduleMe" ] : [ "scheduleAll", "scheduleAttention", "schedulePlanner", "scheduleWhite", "scheduleBlack", "scheduleMe" ] : "团队主页档期查询显示" == a ? i = h ? [ "teamHomeScheduleAll", "teamHomeScheduleAttention", "teamHomeScheduleTeam", "teamHomeSchedulePlanner", "teamHomeScheduleWhite", "teamHomeScheduleBlack", "teamHomeScheduleMe" ] : [ "teamHomeScheduleAll", "teamHomeScheduleAttention", "teamHomeSchedulePlanner", "teamHomeScheduleWhite", "teamHomeScheduleBlack", "teamHomeScheduleMe" ] : "电话" == a ? i = 1 == parseInt(r) ? h ? [ "phoneAll", "phoneAttention", "phoneTeam", "phoneWhite", "phoneBlack", "phoneMe" ] : [ "phoneAll", "phoneAttention", "phoneWhite", "phoneBlack", "phoneMe" ] : h ? [ "phoneAll", "phoneAttention", "phoneTeam", "phonePlanner", "phoneWhite", "phoneBlack", "phoneMe" ] : [ "phoneAll", "phoneAttention", "phonePlanner", "phoneWhite", "phoneBlack", "phoneMe" ] : "价格" == a && (i = h ? [ "priceAll", "priceAttention", "priceTeam", "pricePlanner", "priceWhite", "priceBlack", "priceMe" ] : [ "priceAll", "priceAttention", "pricePlanner", "priceWhite", "priceBlack", "priceMe" ]), 
        this.setData({
            permission: t,
            titleArray: o,
            setArray: i
        });
    },
    bindClickItem: function(a) {
        var o, i, l = a.currentTarget.dataset.index, c = this, r = this.data.permission.permissionId, h = this.data.setArray[l], s = a.currentTarget.dataset.select;
        i = 0 == parseInt(s) ? 1 : 0, n.network.post({
            url: n.url.updatePermission,
            params: (o = {}, e(o, h, i), e(o, "id", r), o),
            before: function() {
                wx.showNavigationBarLoading();
            },
            success: function(e) {
                1 == e.data.result ? (c.setData({
                    permission: e.data.data.permission
                }), t.postNotificationName("didChangePrivacy")) : n.util.showToast(e.data.message);
            },
            fail: function() {
                n.util.showToast("设置失败");
            },
            complete: function() {
                wx.hideNavigationBarLoading();
            }
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {
        return {
            title: n.globalData.commonShareTitle,
            path: n.globalData.commonSharePath,
            imageUrl: n.globalData.commonShareImage,
            success: function(e) {},
            fail: function(e) {}
        };
    }
});